//
//  DeviceModel.swift
//  DKE-Album
//
//  Created by dagny on 2025/9/20.
//  Copyright © 2025 杨东宝. All rights reserved.
//

import Foundation
import CoreBluetooth

struct  DeviceModel: Convertible {
    init() {}
    var isWifi:Bool? = false   //蓝牙和wifi
    var isYehuo:Bool? = false
    var screenType:ScreenEnum?{
        get{
            return self.screenType
        }
        set(newType){
            screenType = newType
            switch newType {
            case .ELECTRONICALBUM_0390_BW:
                screen = ELECTRONICALBUM_0390_BW
                isYehuo = false
            case .ELECTRONICALBUM_0750_E5:
                screen = ELECTRONICALBUM_0750_E5
                isYehuo = false
            case .ELECTRONICALBUM_0970_E5:
                screen = ELECTRONICALBUM_0970_E5
                isYehuo = false
            case .ELECTRONICALBUM_1160_E5:
                screen = ELECTRONICALBUM_1160_E5
                isYehuo = false
            case .ELECTRONICALBUM_1330_E6:
                screen = ELECTRONICALBUM_1330_E6
                isYehuo = false
            case .ELECTRONICALBUM_2530_BW:
                screen = ELECTRONICALBUM_2530_BW
                isYehuo = true
            case .ELECTRONICALBUM_2530_E6:
                screen = ELECTRONICALBUM_2530_E6
                isYehuo = true
            case .ELECTRONICALBUM_2800_E6:
                screen = ELECTRONICALBUM_2800_E6
                isYehuo = true
            case .ELECTRONICALBUM_3120_BW:
                screen = ELECTRONICALBUM_3120_BW
                isYehuo = true
            case .ELECTRONICALBUM_3150_E6:
                screen = ELECTRONICALBUM_3150_E6
                isYehuo = false
            case .ELECTRONICALBUM_4200_BW:
                screen = ELECTRONICALBUM_4200_BW
                isYehuo = true
            case nil:
                screen = ELECTRONICALBUM_0750_E5
                isYehuo = false
            }
    
        }
    
    }
    var screen:Screen?
    var name : String?    //名称
    var ID : String?    //id
    var rssi:Int = 0
    var per:CBPeripheral?
    init(isWifi:Bool? = false, name: String? = nil, ID: String? = nil, rssi:Int = 0,peripheral: CBPeripheral? = nil,screenType:ScreenEnum? = .ELECTRONICALBUM_0750_E5) {
        self.isWifi = isWifi
        self.name = name
        self.ID = ID
        self.per = peripheral
        self.rssi = rssi
        self.screenType = screenType
    }
}
